//
//  UIBarButtonItem+YTTBarButtonItem.m
//  跑圈儿
//
//  Created by 唐康 on 16/4/19.
//  Copyright © 2016年 唐康. All rights reserved.
//

#import "UIBarButtonItem+YTTBarButtonItem.h"

@implementation UIBarButtonItem (YTTBarButtonItem)
+(instancetype)itemWithImage:(NSString *)image highLightImage:(NSString *)highLightImage target:(id)target action:(SEL)action{
    UIButton *button = [UIButton buttonWithType:(UIButtonTypeCustom)];
    [button setBackgroundImage:[UIImage imageNamed:image] forState:(UIControlStateNormal)];
    [button setBackgroundImage:[UIImage imageNamed:highLightImage] forState:(UIControlStateHighlighted)];
    button.size = button.currentBackgroundImage.size;
    [button addTarget:target action:action forControlEvents:(UIControlEventTouchUpInside)];
    return [[self alloc]initWithCustomView:button];
}
@end
